package com.fortune.service.impl;

import com.fortune.dao.MUnitDao;
import com.fortune.dto.in.mUnit.MUnitAddDto;
import com.fortune.dto.in.mUnit.MUnitEditDto;
import com.fortune.dto.in.mUnit.MUnitListDto;
import com.fortune.service.MUnitService;
import com.fortune.vo.mUnit.MUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MUnitServiceImpl implements MUnitService {
    @Autowired
    private MUnitDao mUnitDao;

    /**
     * 查询商品单位
     * @param companyId
     * @return
     */
    @Override
    public List<MUnit> queryMunit(String companyId,MUnitListDto mUnitListDto) {
        return mUnitDao.queryMunit(companyId,mUnitListDto);
    }

    /**
     * 查询商品单位个数
     * @param companyId
     * @param mUnitListDto
     * @return
     */
    @Override
    public int queryMunitCount(String companyId, MUnitListDto mUnitListDto) {
        return mUnitDao.queryMunitCount(companyId,mUnitListDto);
    }

    /**
     * 添加商品单位
     * @param companyId
     * @param mUnitAddDto
     * @return
     */
    @Override
    public int addMunit(String companyId, MUnitAddDto mUnitAddDto) {
        return mUnitDao.addMunit(companyId,mUnitAddDto);
    }

    /**
     * 编辑商品单位
     * @param companyId
     * @param mUnitEditDto
     * @return
     */
    @Override
    public int editMunit(String companyId, MUnitEditDto mUnitEditDto) {
        return mUnitDao.editMunit(companyId,mUnitEditDto);
    }

    /**
     * 删除商品单位
     * @param companyId
     * @param mUnitId
     * @return
     */
    @Override
    public int deleteMunit(String companyId, String mUnitId) {
        return mUnitDao.deleteMunit(companyId,mUnitId);
    }

    /**
     * 查询该名称是否存在
     * @param companyId
     * @param mUnitAddDto
     * @return
     */
    @Override
    public int queryMunitExist(String companyId, MUnitAddDto mUnitAddDto) {
        return mUnitDao.queryMunitExist(companyId,mUnitAddDto);
    }

    /**
     * 编辑时查询该名称是否存在
     * @param companyId
     * @param mUnitEditDto
     * @return
     */
    @Override
    public int queryEditMunitExist(String companyId, MUnitEditDto mUnitEditDto) {
        return mUnitDao.queryEditMunitExist(companyId,mUnitEditDto);
    }

    /**
     * 查询商品单位
     * @param companyId
     * @return
     */
    @Override
    public List<MUnit> queryProduceMunit(String companyId) {
        return mUnitDao.queryProduceMunit(companyId);
    }


}
